Skip to content

build(deps-dev): replace standard with neostandard#421

Merged
Fdawgs merged 2 commits intomasterfrom
build/neostandard
Nov 29, 2024
Merged

build(deps-dev): replace standard with neostandard#421
Fdawgs merged 2 commits intomasterfrom
build/neostandard

Conversation

@Fdawgs
Copy link
Member

@Fdawgs Fdawgs commented Nov 29, 2024

Checklist

resolve("");
});
});
const child = exec(`${instance} "${process.cwd()}/test/typescript-jest/integration/instance.ts"`)

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [absolute path](1).

Copilot Autofix

AI about 1 year ago

To fix the problem, we should avoid constructing the shell command using template literals and instead use the execFile method from the child_process module. This method allows us to pass the command and its arguments separately, which prevents the shell from interpreting special characters in the arguments.

We need to:

  1. Replace the exec method with execFile.
  2. Pass the command and its arguments as separate parameters to execFile.
Suggested changeset 1
test/typescript-jest/integration/integration.test.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/test/typescript-jest/integration/integration.test.ts b/test/typescript-jest/integration/integration.test.ts
--- a/test/typescript-jest/integration/integration.test.ts
+++ b/test/typescript-jest/integration/integration.test.ts
@@ -1,2 +1,2 @@
-import { exec } from 'child_process'
+import { execFile } from 'child_process'
 
@@ -7,3 +7,3 @@
       await new Promise(function (resolve, reject) {
-        const child = exec(`${instance} "${process.cwd()}/test/typescript-jest/integration/instance.ts"`)
+        const child = execFile(instance, [`${process.cwd()}/test/typescript-jest/integration/instance.ts`])
         let stderr = ''
EOF
@@ -1,2 +1,2 @@
import { exec } from 'child_process'
import { execFile } from 'child_process'

@@ -7,3 +7,3 @@
await new Promise(function (resolve, reject) {
const child = exec(`${instance} "${process.cwd()}/test/typescript-jest/integration/instance.ts"`)
const child = execFile(instance, [`${process.cwd()}/test/typescript-jest/integration/instance.ts`])
let stderr = ''
Copilot is powered by AI and may make mistakes. Always verify output.
@Fdawgs
Copy link
Member Author

Fdawgs commented Nov 29, 2024

Test failure unrelated, see #420 which is also failing.

@Fdawgs Fdawgs merged commit 5587737 into master Nov 29, 2024
@Fdawgs Fdawgs deleted the build/neostandard branch November 29, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants